package view
{
    import flash.display.*;
    import flash.events.*;

    public class Tower extends Sprite
    {
        public static var WIDTH:Number = 24;
        public static var HEIGHT:Number = 24;

        private var mouseOverColor:uint = 0x0080FF;
        private var mouseOutColor:uint = 0x001133;

        public function Tower(x:Number=0, y:Number=0)
        {
            this.x = x;
            this.y = y;
            addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
            addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
        }

        public function drawBackground(color:uint=0x001133):void
        {
            graphics.clear();
            graphics.lineStyle(1, 0xaaaaaa);
            graphics.beginFill(color, 1);
            graphics.moveTo(0, 0);
            graphics.lineTo(Tower.WIDTH, 0);
            graphics.lineTo(Tower.WIDTH, Tower.HEIGHT);
            graphics.lineTo(0, Tower.HEIGHT);
            graphics.endFill();
        }

        private function mouseOver(e:MouseEvent):void
        {
            this.drawBackground(mouseOverColor);
        }

        private function mouseOut(e:MouseEvent):void
        {
            this.drawBackground(mouseOutColor);
        }
    }
}
